package com.chenzhou.product_sys.common;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 数据库获取连接工具类
 */
public class DBuitl {


    private static final String driver = "com.mysql.jdbc.Driver";
    private static final String url = "jdbc:mysql://localhost:3306/db_b2bsystem";
    private static final String username = "root";
    private static final String password = "123456";

    /**
     * 获取连接
     * @return
     */
    public static Connection get_Connection(){

        try {
            Class.forName(driver);
            return DriverManager.getConnection(url,username,password);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
